package com.qiku.server.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qiku.mapper.PromotionAdMapper;
import com.qiku.authority.pojo.PromotionAd;
import com.qiku.server.PromotionAdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PromotionAdServerImpl extends ServiceImpl<PromotionAdMapper , PromotionAd> implements PromotionAdService {

    @Autowired
    private PromotionAdMapper promotionAdMapper;


    /**
     * 根据广告位id  查询广告
     * @param sid
     * @return
     */
    @Override
    public List<PromotionAd> getAdsBySpaceId(Integer sid) {
        QueryWrapper<PromotionAd> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("space_id" , sid);
        return promotionAdMapper.selectList(queryWrapper);
    }
}
